
mexico.panel <- read.table(file="�mexico_data.txt", sep="\t", header=T)

summary(mexico.panel)
mexico.panel <- as.data.frame(mexico.panel)


library(lattice)
library(nlme)
attach(mexico.panel)


####### Table 1 Applied Tariff


world.tariff.panel <-lme(W.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.W^(1/3)) + IIT.W+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~year|Rama.1989/Product)
data = mexico.panel)

summary(world.tariff.panel)


pre.1997 <- subset(mexico.panel, year < 1997)
post.1997 <- subset(mexico.panel, year > 1997)



pre97.world.tariff.panel <-lme(W.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.W^(1/3)) + IIT.W+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~year|Rama.1989/Product),
data=pre.1997
)

summary(pre97.world.tariff.panel)

post97.world.tariff.panel <-lme(W.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.W^(1/3)) + IIT.W+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~year|Rama.1989/Product),
data=post.1997
)

summary(post97.world.tariff.panel)


#### Chow Test for structural difference #####

#########  This is an example how to implement the Chew-test
####  objects �full.model�, �part.one�, & �part.two� hold the different models



full.model <- world.tariff.panel
part.one <- pre97.world.tariff.panel
part.two <- post97.world.tariff.panel

k <- 66

##

full.resid <- as.matrix(residuals(full.model, type="response"))
p1.resid <- as.matrix(residuals(part.one, type="response"))
p2.resid <- as.matrix(residuals(part.two, type="response"))

n.full <- length(residuals(full.model, type="response"))
n.p1 <- length(residuals(part.one, type="response"))
n.p2 <- length(residuals(part.two, type="response"))



full.SS <- t(full.resid)%*%full.resid
p1.SS <- t(p1.resid)%*%p1.resid
p2.SS <- t(p2.resid)%*%p2.resid

df1 <- k
df2 <- n.p1+n.p2-2*k

f.stat <- ((full.SS - (p1.SS+p2.SS))/k)/((p1.SS+p2.SS)/(n.p1+n.p2-2*k))

f.stat
df1
df2
1-pf(f.stat, df1, df2)


####### End of Chow Test
#######




pre.NAFTA<- subset(mexico.panel, year < 1990)
post.NAFTA <- subset(mexico.panel, year > 1990)



preNAFTA.world.tariff.panel <-lme(W.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.W^(1/3)) + IIT.W+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
data= pre.NAFTA
)

summary(preNAFTA.world.tariff.panel)

postNAFTA.world.tariff.panel <-lme(W.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.W^(1/3)) + IIT.W+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~year|Rama.1989/Product),
data= post.NAFTA
)

summary(postNAFTA.world.tariff.panel)



#### Chow Test for structural difference	#####
####   pre vs post NAFTA			#####

full.model <- world.tariff.panel
part.one <- preNAFTA.world.tariff.panel
part.two <- postNAFTA.world.tariff.panel

k <- 66

##

full.resid <- as.matrix(residuals(full.model, type="response"))
p1.resid <- as.matrix(residuals(part.one, type="response"))
p2.resid <- as.matrix(residuals(part.two, type="response"))

n.full <- length(residuals(full.model, type="response"))
n.p1 <- length(residuals(part.one, type="response"))
n.p2 <- length(residuals(part.two, type="response"))



full.SS <- t(full.resid)%*%full.resid
p1.SS <- t(p1.resid)%*%p1.resid
p2.SS <- t(p2.resid)%*%p2.resid

df1 <- k
df2 <- n.p1+n.p2-2*k

f.stat <- ((full.SS - (p1.SS+p2.SS))/k)/((p1.SS+p2.SS)/(n.p1+n.p2-2*k))

f.stat
df1
df2
1-pf(f.stat, df1, df2)


####### End of Chow Test
#######




#######
####### Table 1 NTB
#######


NTB.world <- glmer(NTB ~ 
	prev_NTB + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial, data=mexico.panel)

summary(NTB.world)


pre.1997.world.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=pre.1997)

summary(pre.NAFTA.world.NTB)



post.1997.world.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=post.1997)


summary(post.1997.world.NTB)




#### Chow Test for structural difference	#####
####   pre 1997 vs. post 1997		#####
####

full.model <- NTB.world
part.one <- pre.1997.world.NTB
part.two <- post.1997.world.NTB

k <- 66

##

full.resid <- as.matrix(residuals(full.model, type="response"))
p1.resid <- as.matrix(residuals(part.one, type="response"))
p2.resid <- as.matrix(residuals(part.two, type="response"))

n.full <- length(residuals(full.model, type="response"))
n.p1 <- length(residuals(part.one, type="response"))
n.p2 <- length(residuals(part.two, type="response"))



full.SS <- t(full.resid)%*%full.resid
p1.SS <- t(p1.resid)%*%p1.resid
p2.SS <- t(p2.resid)%*%p2.resid

df1 <- k
df2 <- n.p1+n.p2-2*k

f.stat <- ((full.SS - (p1.SS+p2.SS))/k)/((p1.SS+p2.SS)/(n.p1+n.p2-2*k))

f.stat
df1
df2
1-pf(f.stat, df1, df2)


####### End of Chow Test
#######



pre.NAFTA.world.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	(1|Rama.1989),
	family=binomial,
	data= pre.NAFTA)

summary(pre.NAFTA.world.NTB)



post.NAFTA.world.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=post.NAFTA)

summary(post.NAFTA.world.NTB)

#### Chow Test for structural difference	#####
####   pre 1997 vs. post 1997		#####

full.model <- NTB.world
part.one <- pre.NAFTA.world.NTB
part.two <- post.NAFTA.world.NTB

k <- 66

##

full.resid <- as.matrix(residuals(full.model, type="response"))
p1.resid <- as.matrix(residuals(part.one, type="response"))
p2.resid <- as.matrix(residuals(part.two, type="response"))

n.full <- length(residuals(full.model, type="response"))
n.p1 <- length(residuals(part.one, type="response"))
n.p2 <- length(residuals(part.two, type="response"))



full.SS <- t(full.resid)%*%full.resid
p1.SS <- t(p1.resid)%*%p1.resid
p2.SS <- t(p2.resid)%*%p2.resid

df1 <- k
df2 <- n.p1+n.p2-2*k

f.stat <- ((full.SS - (p1.SS+p2.SS))/k)/((p1.SS+p2.SS)/(n.p1+n.p2-2*k))

f.stat
df1
df2
1-pf(f.stat, df1, df2)


####### End of Chow Test
#######





##### Pooled Likelihhod
logLik(NTB.world)
logLik.glmer.out <- logLik(NTB.world)

##### Sum Likelihood 1997 break

logLik.pre.panel.out <- logLik(pre.1997.world.NTB)
logLik.post.panel.out <- logLik(post.1997.world.NTB)



#### Sum Likelihood NAFTA break

logLik.pre.NAFTA.panel.out <- logLik(pre.NAFTA.world.NTB)
logLik.post.NAFTA.panel.out <- logLik(post.NAFTA.world.NTB)



#####
##### Log likelihood ratio test
#####

full.model <- logLik.glmer.out[1]
part.one <- logLik.pre.panel.out[1]
part.two <- logLik.post.panel.out[1]

df.full <- 14
df.p1 <- 11
df.p2 <- 13

Diff <- 2*((part.one + part.two)- full.model)
Diff
(df.p1+df.p2)-df.full

1- pchisq(Diff, ((df.p1+df.p2)-df.full))


######


#####
##### Log likelihood ratio test NAFTA split
#####

full.model <- logLik.glmer.out[1]
part.one <- logLik.pre.NAFTA.panel.out[1]
part.two <- logLik.post.NAFTA.panel.out[1]

df.full <- 14
df.p1 <- 11
df.p2 <- 13

Diff <- 2*((part.one + part.two)- full.model)
Diff
(df.p1+df.p2)-df.full

1- pchisq(####, (df.p1+df.p2)-df.full))


######

#####
##### Log likelihood ratio test  NAFTA vs 1997
#####


df <- 1

D <- -2*((logLik.pre.panel.out4[1] + logLik.post.panel.out[1])-(logLik.pre.NAFTA.panel.out4[1] + logLik.post.NAFTA.panel.out[1]))
D
  
logLik.pre.panel.out + logLik.post.panel.out4
logLik.pre.NAFTA.panel.out + logLik.post.NAFTA.panel.out

1- pchisq(####, df)


######




########
#####	Table 2
#####	Non.NAFTA. Tarifff 
########




non.NAFTA.Tariff <-lme(nonNAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.noNAFTA^(1/3)) + IIT.noNAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product),
data= mexico.panel)

summary(non.NAFTA.Tariff)



pre.non.NAFTA.Tariff <-lme(nonNAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.noNAFTA^(1/3)) + IIT.noNAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product),
data=pre.1997
)

summary(pre.non.NAFTA.Tariff)

post.non.NAFTA.Tariff <-lme(nonNAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.noNAFTA^(1/3)) + IIT.noNAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product),
data=post.1997
)

summary(post.non.NAFTA.Tariff)




#### Chow Test for structural difference #####

full.model <- non.NAFTA.Tariff
part.one <- pre.non.NAFTA.Tariff
party.two <- post.non.NAFTA.Tariff

k <- 66

##

full.resid <- as.matrix(residuals(full.model, type="response"))
p1.resid <- as.matrix(residuals(part.one, type="response"))
p2.resid <- as.matrix(residuals(party.two, type="response"))

n.full <- length(residuals(full.model, type="response"))
n.p1 <- length(residuals(part.one, type="response"))
n.p2 <- length(residuals(party.two, type="response"))



full.SS <- t(full.resid)%*%full.resid
p1.SS <- t(p1.resid)%*%p1.resid
p2.SS <- t(p2.resid)%*%p2.resid

df1 <- k
df2 <- n.p1+n.p2-2*k

f.stat <- ((full.SS - (p1.SS+p2.SS))/k)/((p1.SS+p2.SS)/(n.p1+n.p2-2*k))

f.stat
df1
df2
1-pf(f.stat, df1, df2)


####### End of Chow Test
#######


#######
####### Wald Test for Structural Change
#######

part.one <- pre.non.NAFTA.Tariff
part.two <- post.non.NAFTA.Tariff

V1 <- summary(part.one)$corFixed
B1 <- part.one$coefficients$fixed

V2 <- summary(part.two)$corFixed
B2 <- part.two$coefficients$fixed

### Wald State ####

W.stat <- t(B1-B2)%*%solve((V1+V2)^-1)%*%(B1-B2)
W.stat
1-pchisq(W.stat, 65)


W.stat <- t(B2-B1)%*%solve((V2+V1)^-1)%*%(B2-B1)
W.stat
1-pchisq(W.stat, 65)


######
######


#####
##### Log likelihood ratio test
#####

full.model <- non.NAFTA.Tariff
part.one <- pre.non.NAFTA.Tariff
party.two <- post.non.NAFTA.Tariff

df.full <- full.model$fixDF$X[2]
df.p1 <- part.one$fixDF$X[2]
df.p2 <- part.two$fixDF$X[2]

D <- -2*(full.model$logLik -(part.one$logLik + part.two$logLik))
D
df.full-(df.p1+df.p2)

1- pchisq(D, (df.full-(df.p1+df.p2)))


######


######
###### non.NAFTA NTB
######


non.NAFTA.NTB <- glmer(NTB_noNAFTA ~ 
	prev_NTB_noNAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.noNAFTA ^(1/3)))+IIT.noNAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial, data=mexico.panel)

summary(non.NAFTA.NTB)



pre1997.nonNAFTA.NTB <- glmer(NTB_noNAFTA ~ 
	prev_NTB_noNAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.noNAFTA ^(1/3)))+IIT.noNAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=pre.1997)

summary(pre1997.nonNAFTA.NTB)


post1997.nonNAFTA.NTB <- glmer(NTB_noNAFTA ~ 
	prev_NTB_noNAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.noNAFTA ^(1/3)))+IIT.noNAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=post.1997)


summary(post1997.nonNAFTA.NTB)





preNAFTA.nonNAFTA.NTB <- glmer(NTB_noNAFTA ~ 
	prev_NTB_noNAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.noNAFTA ^(1/3)))+IIT.noNAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	(1|Rama.1989),
	family=binomial,
	data=pre.implementation
)

summary(preNAFTA.nonNAFTA.NTB)




postNAFTA.nonNAFTA.NTB <- glmer(NTB_noNAFTA ~ 
	prev_NTB_noNAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.noNAFTA ^(1/3)))+IIT.noNAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=post.implementation
)

summary(postNAFTA.nonNAFTA.NTB)




##### Pooled Likelihhod
logLik.glmer.out <- logLik(non.NAFTA.NTB)

##### Sum Likelihood 1997 break

logLik.pre.panel.out <- logLik(pre1997.nonNAFTA.NTB)
logLik.post.panel.out <- logLik(post1997.nonNAFTA.NTB)




#### Sum Likelihood NAFTA break
logLik.pre.NAFTA.panel.out <- logLik(preNAFTA.nonNAFTA.NTB)
logLik.post.NAFTA.panel.out <- logLik(postNAFTA.nonNAFTA.NTB)



#####
##### Log likelihood ratio test
#####

full.model <- logLik.glmer.out[1]
part.one <- logLik.pre.panel.out[1]
part.two <- logLik.post.panel.out[1]

df.full <- 14
df.p1 <- 11
df.p2 <- 13

Diff <- 2*((part.one + part.two)- full.model)
Diff
(df.p1+df.p2)-df.full

1- pchisq(Diff, df.full)


######


#####
##### Log likelihood ratio test NAFTA split
#####

full.model <- logLik.glmer.out[1]
part.one <- logLik.pre.NAFTA.panel.out[1]
part.two <- logLik.post.NAFTA.panel.out[1]

df.full <- 14
df.p1 <- 11
df.p2 <- 13

Diff <- 2*((part.one + part.two)- full.model)
Diff
(df.p1+df.p2)-df.full

1- pchisq(Diff, df.full)


######

#####
##### Log likelihood ratio test  NAFTA vs 1997
#####


df <- 14

D <- -2*((logLik.pre.panel.out[1] + logLik.post.panel.out[1])-(logLik.pre.NAFTA.panel.out[1] + logLik.post.NAFTA.panel.out[1]))
D
  
logLik.pre.panel.out + logLik.post.panel.out
logLik.pre.NAFTA.panel.out + logLik.post.NAFTA.panel.out

1- pchisq(D, df)


######




NAFTA.tariff <-lme(NAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.NAFTA^(1/3)) + IIT.NAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product)
)

summary(NAFTA.tariff)




pre1997.NAFTA.tariff <-lme(NAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.NAFTA^(1/3)) + IIT.NAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product),
data=pre.1997
)

summary(pre1997.NAFTA.tariff)

post1997.NAFTA.tariff <-lme(NAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.NAFTA^(1/3)) + IIT.NAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product),
data=post.1997
)

summary(post1997.NAFTA.tariff)


preNAFTA.NAFTA.tariff <-lme(NAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.NAFTA^(1/3)) + IIT.NAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod),
random=~1|Rama.1989,
data= pre.NAFTA)

summary(preNAFTA.NAFTA.tariff)

postNAFTA.NAFTA.tariff <-lme(NAFTA.Ave.Tariff~I(1/3*Import.Share^(1/3)) + I(1/3*M.Pen.NAFTA^(1/3)) + IIT.NAFTA+
log10(averagewages) + log10(natprod) + polcon +
log10(natprod)*polcon +
log10(subtotalprod) +
as.factor(year),
random=~1|Rama.1989,
correlation=corAR1(form=~1|Rama.1989/Product),
data= post.NAFTA)

summary(postNAFTA.NAFTA.tariff)




#####
##### Log likelihood ratio test
#####

full.model <- NAFTA.tariff
part.one <- pre1997.NAFTA.tariff
part.two <- post1997.NAFTA.tariff

df.full <- full.model$fixDF$X[2]
df.p1 <- part.one$fixDF$X[2]
df.p2 <- part.two$fixDF$X[2]

D <- -2*(full.model$logLik -(part.one$logLik + part.two$logLik))
D
df.full-(df.p1+df.p2)

1- pchisq(D, (df.full-(df.p1+df.p2)))


######


#####
##### Log likelihood ratio test NAFTA split
#####

full.model <- NAFTA.tariff
part.one <- preNAFTA.NAFTA.tariff
part.two <- post1997.NAFTA.tariff

df.full <- full.model$fixDF$X[2]
df.p1 <- part.one$fixDF$X[2]
df.p2 <- part.two$fixDF$X[2]

D <- -2*(full.model$logLik -(part.one$logLik + part.two$logLik))
D
df.full-(df.p1+df.p2)

1- pchisq(D, (df.full-(df.p1+df.p2)))


######




NAFTA.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial, data=mexico.panel)

summary(NAFTA.NTB) 



pre1997.NAFTA.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=pre.1997)

summary(pre1997.NAFTA.NTB)




post1997.NAFTA.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=post.1997)


summary(post1997.NAFTA.NTB)



preNAFTA.NAFTA.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	(1|Rama.1989),
	family=binomial,
	data=pre.NAFTA)

summary(preNAFTA.NAFTA.NTB)




postNAFTA.NAFTA.NTB <- glmer(NTB_NAFTA ~ 
	prev_NTB_NAFTA + I(1/3*(Import.Share^(1/3)))+ I(1/3*(M.Pen.NAFTA ^(1/3)))+IIT.NAFTA + log(averagewages)+
	log(natprod) + polcon +log(natprod)*polcon +
	log(subindustprod) +
	as.factor(year) +
	(1|Rama.1989),
	family=binomial,
	data=post.NAFTA)

summary(postNAFTA.NAFTA.NTB)


##### tests
